const setRules = {
  inviteRules: {
    ivTime: [{
      required: true,
      message: '请选择面试时间',
      trigger: 'change',
    }],
    ivLoc: [{
      required: true,
      message: '请输入面试地点',
      trigger: 'change',
    }],
    conactPeople: [{
      required: true,
      message: '请输入联系人',
      trigger: 'change',
    }],
    conactMoblie: [{
        required: true,
        message: '请输入手机号',
        trigger: 'change',
      },
      {
        pattern: /^1[345789]\d{9}$/,
        message: '请输入正确的手机号',
        trigger: 'change',
      }
    ]
  },
  jobTitle: [{
      max: 50,
      message: '求职标题不能超过50个字',
      trigger: 'change',
    },
    {
      required: true,
      message: '请输入求职标题',
      trigger: 'change'
    }
  ],
  name: [
    // 对name字段进行长度验证
    {
      max: 8,
      message: '姓名不能超过8个字',
      trigger: 'change',
    },
    // 对name字段进行必填验证
    {
      required: true,
      message: '请填写姓名',
      trigger: 'change'
    },
  ],
  sex: [{
    required: true,
    message: '请选择性别',
    trigger: 'change'
  }, ],
  age: [{
      required: true,
      message: '请填写年龄',
      trigger: 'change'
    },
    {
      pattern: /^\d+$/,
      message: '年龄只能为正整数',
      trigger: 'change',
    }
  ],
  work_type: [{
    required: true,
    message: '请选择结算方式',
    trigger: 'change'
  }, ],
  salary: [{
    required: true,
    message: '请填写薪资',
    trigger: 'change'
  }],
  speciality: [{
    required: false,
    message: '请填写个人简介',
    trigger: 'change'
  }, ],
  work_exp: [{
    required: true,
    message: '请选择工作经验',
    trigger: 'change'
  }],
  want_loc: [{
    required: true,
    message: '请选择期望工作地',
    trigger: 'change'
  }],


  // wantJob: [{
  //   required: false,
  //   message: '请选择期望工种',
  //   trigger: 'change'
  // },],
  // length: [{
  //   required: true,
  //   message: '请选择长短工',
  //   trigger: 'change'
  // },],
  proExp: [{
    required: false,
    message: '请输入项目经验',
    trigger: 'change'
  }, ],
  // 校验手机格式
  rulesPhone: {
    proofPhone(phone, text) {
      text = text || '手机号码'
      let reg = /^[1][345789][0-9]{9}$/
      if (!reg.test(phone) || phone.length !== 11) {
        uni.showToast({
          title: '请输入正确的' + text,
          duration: 1500,
          icon: 'none'
        });
        return false
      }
      return true
    }
  },

  // 校验验证码
  rulesCode: {
    checkCode(code) {
      if (code == '') {
        uni.showToast({
          title: '请输入验证码',
          duration: 1500,
          icon: 'none'
        });
        return false
      }
      return true
    }
  },

  // 校验数字
  rulesNumber: {
    checkNumber(num, type) {
      let _reg = /^[1-9]\d*$/
      if (!_reg.test(num)) {
        uni.showToast({
          title: '期望薪资只能为正整数',
          duration: 1500,
          icon: 'none'
        });
        return false
      } else {
        if (type == 1 && num > 0 && num > 150) {
          uni.showToast({
            title: '时薪期望薪资只能为0-150',
            duration: 1500,
            icon: 'none'
          });
          return false
        } else if (type == 2 && num > 0 && num > 600) {
          uni.showToast({
            title: '日薪期望薪资只能为0-600',
            duration: 1500,
            icon: 'none'
          });
          return false
        } else {
          return true
        }
      }
    }
  },

  // 企业相关校验
  entRules: {
    ent_name: [{
      required: true,
      message: '请填写企业名称',
      trigger: 'change'
    }, ],
    ent_address: [{
      required: true,
      message: '请填写企业地址',
      trigger: 'change'
    }, ],
    license_key: [{
      required: true,
      message: '请填写营业执照许可证号',
      trigger: 'change'
    }, ],
    name: [{
      required: true,
      message: '请填写联系人姓名',
      trigger: 'change'
    }, ],
    mobile: [{
        required: true,
        message: '请填写联系电话',
        trigger: 'change'
      },
      {
        pattern: /^1[345789]\d{9}$/,
        message: '请输入正确的联系电话',
        trigger: 'change',
      }
    ]
  },
}
module.exports = setRules